home *** CD-ROM | disk | FTP | other *** search
- /* egaworld by bill buckels 1991 */
- /* use bresenham's algorithm to draw lines */
- /* using the writepixel subroutine */
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <fcntl.h>
- #include <string.h>
- #include <dos.h>
- #include <bios.h>
- #include <io.h>
- #include <malloc.h>
- #include <conio.h>
-
- #define BLACK 0
- #define BLUE 1
- #define GREEN 2
- #define CYAN 3
- #define RED 4
- #define MAGENTA 5
- #define BROWN 6
- #define WHITE 7
- #define GRAY 8
- #define LBLUE 9
- #define LGREEN 10
- #define LCYAN 11
- #define LRED 12
- #define LMAGENTA 13
- #define YELLOW 14
- #define BWHITE 15
-
-
-
- #define EGA '\x10'
- #define TEXT '\x03'
-
- unsigned char setcrtmode(unsigned char vidmode)
- {
- union REGS inregs, outregs;
-
- /* set mode */
- inregs.h.ah = 0;
- inregs.h.al = vidmode;
- int86( 0x10, &inregs, &outregs );
-
- /* get mode */
- inregs.h.ah = 0xf;
- int86( 0x10, &inregs, &outregs );
-
- /* return mode */
- return outregs.h.al;
-
- }
-
- void flood(unsigned char floodcolor)
- {
- union REGS rin,rout;
-
- rin.h.dh =43;
- rin.h.dl =79;
- rin.x.cx = 0;
- rin.h.bh= floodcolor;
- rin.x.ax= 0x0600;
- int86(0x10,&rin,&rout);
- }
-
-
- void writepixel(unsigned x, unsigned y, unsigned color)
- {
- union REGS reg;
-
- reg.h.ah = 0x0c;
- reg.h.al = (char )color;
- reg.h.bh = 0;
- reg.x.cx = x;
- reg.x.dx = y;
-
- int86(0x10,®,®);
-
- }
-
-
- void linebox(int x1, int y1, int x2, int y2,unsigned tempcolor)
- {
- register x,y;
-
- x2++;
- x=x1;
- y=y1;
- while(x<x2)
- {
- writepixel(x,y,tempcolor);
- x++;
- }
- y++;
- x2--;
- while(y<y2)
- {
- writepixel(x1,y,tempcolor);
- writepixel(x2,y,tempcolor);
- y++;
- }
-
- x2++;
- x=x1;
- while(x<x2)
- {
- writepixel(x,y,tempcolor);
- x++;
- }
-
- }
-
-
-
-
-
-
- void writeline(int x1,int y1,int x2,int y2,unsigned color)
- {
- union REGS inregs, outregs;
- #define sign(x) ((x)>0?1:((x)==0?0:(-1)))
- int dx,dy,dxabs,dyabs,i,px,py,sdx,sdy,x,y;
-
- inregs.h.ah = 0x0c;
- inregs.h.al = (char )color;
- inregs.h.bh = 0;
-
-
- dx=x2-x1;
- dy=y2-y1;
- sdx=sign(dx);
- sdy=sign(dy);
- dxabs=abs(dx);
- dyabs=abs(dy);
- x=0;
- y=0;
- px=x1;
- py=y1;
-
- if(dxabs >= dyabs)
- {
- for(i=0;i<=dxabs;i++)
- {
- y+=dyabs;
- if(y>=dxabs)
- {y-=dxabs;
- py+=sdy;
- }
- inregs.x.cx = px;
- inregs.x.dx = py;
- int86(0x10,&inregs,&outregs);
- px+=sdx;
- }
- }
- else{
- for(i=0;i<=dyabs;i++)
- {
- x+=dxabs;
- if(x>=dyabs)
- {
- x-=dyabs;
- px+=sdx;
- }
- inregs.x.cx = px;
- inregs.x.dx = py;
- int86(0x10,&inregs,&outregs);
- py+=sdy;
- }
- }
- }
-
-
- #define CRETURN '\x0d'
-
- int egatext(char *str, unsigned x, unsigned y, unsigned colorvalue)
- {
-
- union REGS inregs, outregs;
-
- int scanline,byte,character,nibble; /* flags etcetera */
- int counter;
- unsigned char *romfont=(unsigned char *) 0xffa6000el;
- /* a pointer to the 8 x 8 BITMAPPED font in the PC ROM */
-
- int target = strlen(str); /* string length */
-
- if(!target)return 0;
- for(counter=0;counter<target;counter++){
- if(str[counter]<' '||str[counter]>'z')str[counter]=0;
- if(str[counter]==CRETURN)target=counter;
- }
-
- inregs.h.ah = 0x0c;
- inregs.h.al = (char )colorvalue;
- inregs.h.bh = 0;
-
-
-
- for (scanline=0;scanline<8;scanline++) /* finish the current scanline
- before advancing to the next */
- {
- for (byte=0;byte<target;byte++) /* run the scanline */
- { /* use the current character
- as an indices for the font */
- character = romfont[(str[byte]&0x7f)*8+scanline];
- if (character != 0)
- for (nibble=0;nibble<8;nibble++)
- if (character & 0x80>>nibble)
- {
- inregs.x.cx = x+byte*8+nibble;
- inregs.x.dx = y;
- int86(0x10,&inregs,&outregs);
- }
- }
-
- y++;
- }
- return target;
-
- }
-
- /* center justified x-dimension only */
- int egatextM(unsigned char *str,unsigned xorigin,unsigned yorigin,
- unsigned tempcolor)
- {
- int target = strlen(str); /* string length */
- int counter;
-
- if(!target)return 0;
-
- for(counter=0;counter<target;counter++){
- if(str[counter]<' '||str[counter]>'z')str[counter]=0;
- if(str[counter]==CRETURN)target=counter;
- }
- xorigin=(xorigin-(target*4));/* extrapolate the left edge */
- egatext(str,xorigin,yorigin,tempcolor); /* pass to the usual function */
- return target;
-
- }
-
-
-
-
-
-
- int USA[]=
- {
- /* data statements */
-
- 26,12,32,13,33,14,35,15,34,17,32,18,31,19,31,22,34,22,35,20,36,20,37,
- 18,37,10,36,8,40,8,42,9,44,10,48,12,54,14,62,16,70,18,78,19,86,20,102,
- 21,134,21,150,20,165,20,165,18,168,18,168,20,172,22,176,22,182,24,186,
- 25,192,24,193,24,193,25,192,26,190,28,186,30,184,32,182,34,181,36,184,
- 35,186,34,189,34,188,36,190,36,192,35,194,34,196,32,198,32,201,28,203,
- 28,200,32,199,33,200,33,202,32,206,36,209,36,210,33,214,33,217,31,218,
- 31,218,32,216,34,222,33,223,36,221,36,220,38,218,37,217,36,214,37,211,
- 39,208,39,206,42,203,48,202,50,208,44,208,46,206,50,205,51,204,59,205,
- 64,207,68,208,70,210,70,212,68,214,64,214,62,213,60,212,56,213,54,212,
- 53,212,48,214,46,215,48,216,44,218,42,217,40,220,39,224,40,226,42,226,
- 44,228,46,227,48,225,52,226,54,227,52,228,52,229,51,231,51,232,54,232,
- 56,233,58,234,59,232,61,229,67,234,69,238,68,241,67,243,64,245,64,247,
- 62,251,60,251,53,258,52,262,50,264,50,264,45,262,44,262,43,264,43,266,
- 40,268,36,273,35,280,32,284,31,286,28,289,28,289,24,290,22,289,21,291,
- 15,290,12,290,9,291,9,294,11,296,9,298,10,301,16,303,22,306,24,310,24,
- 310,28,307,29,304,31,304,33,302,31,299,32,299,36,294,39,296,40,294,42,
- 294,48,297,53,297,54,296,55,296,56,292,58,290,58,289,59,286,59,282,64,
- 280,68,282,68,282,74,281,76,280,77,277,77,274,76,279,81,277,83,278,86,
- 277,90,278,93,277,95,276,92,276,88,274,86,273,84,272,77,270,80,270,86,
- 272,89,274,92,274,94,275,96,278,100,280,102,280,105,276,110,278,110,277,
- 112,274,112,270,115,269,119,266,120,264,122,262,126,258,132,256,132,252,
- 140,252,142,254,152,258,160,262,164,266,172,266,182,265,184,262,186,260,
- 184,258,180,256,180,255,179,252,174,252,173,250,173,248,169,248,166,247,
- 167,246,166,246,160,238,152,236,152,236,155,234,156,228,156,226,152,214,
- 152,212,153,207,153,206,152,200,154,194,153,194,155,199,159,203,157,202,
- 160,202,161,203,162,200,162,199,163,198,163,197,164,194,164,192,162,191,
- 159,191,157,189,156,189,157,187,157,186,156,185,160,172,160,162,167,162,
- 168,160,168,159,167,158,168,157,171,153,176,152,178,152,180,154,188,152,
- 188,150,187,146,186,142,184,140,182,138,180,136,172,133,168,131,166,130,
- 162,130,160,126,158,119,158,118,160,115,164,110,160,106,158,106,153,104,
- 150,102,148,100,144,97,140,86,140,86,142,83,142,70,140,48,128,48,126,34,
- 124,34,120,30,113,26,110,25,108,18,106,18,104,16,100,13,98,13,95,14,94,
- 12,90,13,88,13,85,12,84,12,82,10,80,10,68,9,66,9,63,12,56,13,54,13,51,14,
- 49,14,46,15,44,16,45,18,40,22,32,22,30,24,24,24,21,26,20,25,18,25,16,24,
- 14,26,12,-1,-1,
- /* End of Outline. Draw the States */
-
- 286,28,286,29,288,32,290,36,292,40,294,44,-1,-1,285,30,285,32,
- 285,33,285,40,284,43,284,50,281,51,280,48,278,43,277,40,275,34,-1,-1,
- 294,46,290,48,284,50,281,51,282,56,286,55,290,54,294,54,296,55,-1,-1,
- 290,54,291,58,-1,-1,282,56,283,62,-1,-1,282,64,280,62,276,62,274,61,
- 273,56,270,56,249,64,248,62,-1,-1,276,62,274,64,274,68,277,71,277,73,
- 276,74,274,76,278,78,278,79,-1,-1,245,64,249,80,273,75,273,77,274,77,
- 274,76,-1,-1,254,79,255,82,260,80,264,80,267,81,269,81,269,86,270,86,
- -1,-1,273,76,275,85,278,84,-1,-1,259,81,259,83,256,86,256,88,254,88,
- 251,96,248,98,245,99,243,98,241,100,238,101,238,102,234,104,248,104,
- 278,99,-1,-1,244,104,238,110,234,112,231,115,250,113,253,115,260,114,
- 265,115,269,118,-1,-1,238,114,238,120,240,120,241,124,242,124,253,136,
- -1,-1,231,116,222,118,226,128,228,136,230,144,231,148,247,148,248,150,
- 250,146,253,146,-1,-1,231,148,214,148,214,152,-1,-1,210,153,208,119,
- 222,118,-1,-1,208,119,197,120,192,128,190,132,192,132,192,136,193,140,
- 192,144,190,148,190,152,194,158,198,158,-1,-1,197,120,198,117,198,110,
- 230,107,234,104,-1,-1,199,110,200,108,202,107,201,105,202,104,204,104,
- 206,102,208,98,210,97,221,97,221,96,220,95,220,93,222,92,222,90,224,
- 90,224,86,226,86,230,89,233,89,235,88,238,90,238,94,242,96,243,98,-1,-1,
- 238,90,240,86,241,86,245,82,246,80,246,79,248,76,-1,-1,224,86,222,68,
- -1,-1,229,67,212,68,-1,-1,209,70,209,88,207,94,207,100,-1,-1,201,105,
- 200,104,199,103,199,102,194,96,194,92,192,92,189,88,187,86,187,84,188,
- 80,190,77,189,74,193,72,193,70,192,68,188,64,-1,-1,205,64,188,64,186,
- 60,186,54,180,52,179,50,178,50,178,43,181,40,181,36,183,35,-1,-1,192,
- 35,193,38,198,40,201,40,203,41,204,45,-1,-1,158,20,158,30,159,31,159,
- 39,160,40,160,43,158,44,158,46,160,47,160,60,186,60,-1,-1,160,60,159,
- 60,159,62,158,63,158,66,160,68,162,72,162,80,189,80,-1,-1,162,80,164,
- 82,164,83,166,84,168,85,167,88,168,90,169,91,169,92,170,92,170,110,
- 196,110,198,112,-1,-1,170,110,170,132,173,132,174,133,174,136,192,136,
- -1,-1,174,136,172,140,172,142,176,146,178,150,178,154,176,160,-1,-1,
- 123,21,122,40,159,42,-1,-1,122,40,120,62,156,64,158,65,-1,-1,120,62,
- 118,75,128,76,128,84,166,84,-1,-1,128,84,128,106,170,106,-1,-1,128,
- 106,122,106,121,110,138,110,138,124,142,125,143,127,150,128,158,130,
- 161,130,165,129,170,132,-1,-1,121,110,118,140,97,140,-1,-1,80,141,88,
- 102,122,106,-1,-1,88,102,91,72,118,75,-1,-1,91,72,80,70,86,42,122,46,
- -1,-1,86,44,78,43,74,43,72,34,71,33,69,34,68,34,71,27,67,22,68,18,
- -1,-1,63,17,57,32,59,33,56,36,56,40,55,42,55,44,54,46,52,53,52,55,51,
- 56,82,64,-1,-1,66,60,58,96,88,102,-1,-1,58,96,58,102,57,102,54,100,52,
- 108,54,112,54,116,52,116,48,123,49,124,49,126,48,126,-1,-1,56,37,54,36,
- 53,37,46,35,42,34,38,32,36,32,34,31,33,31,34,30,29,27,26,26,24,26,-1,-1,
- 14,46,51,56,-1,-1,36,52,28,73,52,108,-1,-2
- };
-
-
- /* we could use the following coordinates to set up a grid or
- a fill mask for each state. not used at this time.
- fields of the array have the following format:
- STATE CAPITAL HOT POINT X,Y
-
- */
-
- char *STATES[]=
- {
-
- "ALABAMA","MONTGOMERY","220","130",
- "ARIZONA","PHOENIX","70","120",
- "NEW MEXICO","SANTA FE","90","120",
- "ARKANSAS","LITTLE ROCK","180","120",
- "CALIFORNIA","SACRAMENTO","40","120",
- "COLORADO","DENVER","110","90",
- "CONNECTICUT","HARTFORD","288","57",
- "RHODE ISLAND","PROVIDENCE","294","56",
- "DELAWARE","DOVER","276","81",
- "MARYLAND","ANNAPOLIS","268","78",
- "FLORIDA","TALLAHASSEE","260","176",
- "GEORGIA","ATLANTA","250","142",
- "IDAHO","BOISE","70","50",
- "ILLINOIS","SPRINGFIELD","200","80",
- "INDIANA","INDIANAPOLIS","214","80",
- "IOWA","DES MOINES","170","70",
- "KANSAS","TOPEKA","150","90",
- "KENTUCKY","FRANKFORT","214","100",
- "LOUISIANA","BATON ROUGE","180","140",
- "MAINE","AUGUSTA","294","20",
- "MASSACHUSETTS","BOSTON","290","52",
- "MICHIGAN","LANSING","220","50",
- "MICHIGAN","LANSING","206","38", /* paint twice */
- "MINNESOTA","ST PAUL","180","28",
- "MISSISSIPPI","JACKSON","200","140",
- "MISSOURI","JEFFERSON CITY","180","90",
- "MONTANA","HELENA","100","30",
- "NEBRASKA","LINCOLN","140","70",
- "NEVADA","CARSON CITY","40","70",
- "UTAH","SALT LAKE CITY","70","70",
- "NEW HAMPSHIRE","CONCORD","290","40",
- "VERMONT","MONTPELIER","282","40",
- "NEW JERSEY","TRENTON","280","70",
- "NEW YORK","ALBANY","280","56",
- "N. CAROLINA","RALEIGH","270","110",
- "N. DAKOTA","BISMARCK","140","30",
- "S. DAKOTA","PIERRE","140","50",
- "OHIO","COLUMBUS","240","70",
- "OKLAHOMA","OKLAHOMA CITY","150","120",
- "OREGON","SALEM","50","40",
- "PENNSYLVANIA","HARRISBURG","260","70",
- "S. CAROLINA","COLUMBIA","254","120",
- "TENNESSEE","NASHVILLE","210","116",
- "TEXAS","AUSTIN","140","150",
- "VIRGINA","RICHMOND","260","90",
- "WASHINGTON","OLYMPIA","40","24",
- "W. VIRGINIA","CHARLESTON","246","88",
- "WISCONSIN","MADISON","200","50",
- "WYOMING","CHEYENNE","100","60",
- "-1","-1","-1","-1"
- };
-
- /* the coordinates to draw the whole world */
-
- int WORLD[]=
- {
-
- 4,32,
- 6,32, 6,30, 8,28, 12,28,
- 12,24, 16,24, 18,20, 20,20,
- 24,18, 30,18, 34,20, 38,22,
- 50,22, 54,24, 54,26, 60,26,
- 60,24, 56,24, 56,20, 52,20,
- 52,18, 56,16, 60,16, 60,18,
- 64,20, 64,18, 66,18, 66,24,
- 62,24, 64,26, 70,26, 70,22,
- 74,18, 78,18, 72,24, 78,24,
- 78,20, 80,18, 86,18, 92,24,
- 92,28, 86,34, 80,30, 80,28,
- 84,28, 86,26, 84,24, 80,24,
- 80,26, 76,28, 76,32, 68,32,
- 60,38, 60,40, 66,44, 68,44,
- 68,50, 74,42, 72,38, 78,34,
- 80,34, 82,36, 82,38, 86,36,
- 88,44, 92,46, 92,48, 90,48,
- 90,50, 90,52, 92,52, 92,56,
- 86,54, 86,52, 90,50, 84,50,
- 78,50, 80,54, 80,60, 74,60,
- 64,70, 64,74, 56,78, 58,86,
- 56,88, 54,86, 52,80, 48,80,
- 48,82, 42,82, 36,88, 36,92,
- 34,94, 38,98, 42,96, 42,92,
- 48,92, 44,102, 50,102, 50,110,
- 56,110, 56,112, 58,112, 64,106,
- 70,110, 72,108, 84,116, 88,116,
- 90,120, 90,124, 94,124, 96,128,
- 102,128, 108,132, 108,136, 104,142,
- 104,152, 96,160, 96,166, 90,174,
- 90,176, 84,182, 84,188, 86,190,
- 86,198, 90,200, 84,200, 86,198,
- 82,200, 76,192, 70,176, 70,166,
- 68,152, 60,148, 60,146, 52,132,
- 52,124, 56,114, 54,112, 48,112,
- 44,106, 42,106, 42,104, 38,104,
- 38,102, 32,102, 24,98, 26,94,
- 20,80, 22,92, 20,92, 16,84,
- 16,76, 14,74, 14,64, 22,54,
- 24,54, 24,52, 22,48, 24,38,
- 18,34, 14,36, 12,36, 12,38,
- 8,38, 4,40, 4,32,
-
- -1,-1,62,16,
- 68,14, 70,16, 64,18, 62,16,
-
- -1,-1,68,18,
- 72,18, 68,22, 68,18,
-
- -1,-1,72,14,
- 76,14, 76,16, 72,16, 72,14,
-
- -1,-1,84,14,
- 92,8, 88,8, 86,12, 82,12,
- 82,10, 88,8, 96,4, 100,4,
- 102,6, 100,8, 108,6, 116,6,
- 122,2, 128,2, 130,6, 134,6,
- 134,8, 130,16, 128,16, 124,20,
- 126,20, 126,22, 118,24, 116,28,
- 114,28, 106,38, 102,36, 98,28,
- 102,24, 102,22, 104,22, 104,16,
- 96,16, 94,14, 100,8, 96,8,
- 90,16, 88,14, 84,14,
-
- -1,-1,124,26,
- 132,26, 134,28, 128,32, 124,28,
- 124,26,
-
- -1,-1,50,92,
- 52,90, 56,90, 62,94, 58,96,
- 58,94, 50,92,
-
- -1,-1,64,94,
- 68,96, 64,98, 62,96, 64,94,
-
- -1,-1,156,10,
- 160,10, 162,12, 158,14, 156,10,
-
- -1,-1,162,8,
- 164,8, 164,10, 162,8,
-
- -1,-1,162,12,
- 164,12, 164,14, 162,12,
-
- -1,-1,188,20,
- 188,16, 194,12, 196,12, 196,14,
- 190,18, 190,20, 188,20,
-
- -1,-1,192,140,
- 196,138, 196,136, 198,134, 200,140,
- 196,152, 192,154, 190,150, 192,140,
-
- -1,-1,280,40,
- 286,46, 286,50, 284,50, 280,40,
-
- -1,-1,286,52,
- 290,52, 292,54, 288,58, 286,52,
-
- -1,-1,290,58,
- 294,60, 294,66, 286,72, 284,70,
- 288,68, 284,68, 290,64, 290,58,
-
- -1,-1,278,80,
- 280,80, 280,86, 278,84, 278,80,
-
- -1,-1,280,92,
- 282,90, 284,96, 286,100, 284,100,
- 278,96, 280,92,
-
- -1,-1,280,102,
- 280,104, 278,106, 280,102,
-
- -1,-1,284,100,
- 286,104, 284,104, 284,100,
-
- -1,-1,288,104,
- 290,106, 288,112, 286,110, 286,108,
- 284,108, 284,106, 284,104, 286,104,
- 288,104,
-
- -1,-1,276,108,
- 280,108, 280,120, 276,124, 270,124,
- 268,120, 268,114, 272,114, 276,108,
-
- -1,-1,282,116,
- 288,116, 288,118, 284,118, 286,128,
- 282,128, 280,124, 282,116,
-
- -1,-1,290,116,
- 292,116, 292,118, 290,118, 290,116,
-
- -1,-1,294,118,
- 298,118, 300,120, 304,120, 312,124,
- 316,128, 320,128, 316,132, 320,136,
- 314,136, 310,132, 304,134, 302,128,
- 296,124, 294,118,
-
- -1,-1,286,132,
- 280,132, 280,134, 282,134,
-
- -1,-1,286,134,
- 288,132,
-
- -1,-1,320,172,
- 324,172, 326,180, 320,186, 318,184,
- 308,192, 304,192, 304,190, 316,182,
- 318,184, 318,180, 322,178, 320,172,
-
- -1,-1,266,170,
- 268,166, 268,152, 272,148, 276,148,
- 286,140, 290,140, 296,136, 300,136,
- 300,140, 304,144, 306,136, 308,136,
- 312,152, 316,156, 304,176, 292,178,
- 296,180, 296,182, 292,184, 292,178,
- 288,168, 278,168, 278,170, 268,170,
- 266,168,
-
- -1,-1,252,110,
- 254,110, 266,122, 264,130, 272,132,
- 274,130, 272,128, 262,128, 252,114,
- 252,110,
-
- -1,-1,136,40,
- 140,38, 142,40, 142,44, 144,46,
- 144,48, 136,50, 138,44, 136,40,
-
- -1,-1,136,44,
- 136,48, 132,48, 134,44, 136,44,
-
- -1,-1,130,72,
- 120,88, 120,104, 132,114, 148,114,
- 148,120, 154,128, 154,136, 152,140,
- 152,146, 162,166, 172,166, 182,152,
- 182,146, 188,140, 188,132, 186,128,
- 186,124, 200,108, 200,102, 192,104,
- 184,94, 180,80, 188,92, 192,100,
- 200,98, 204,96, 210,88, 206,84,
- 216,84, 220,90, 224,90, 226,104,
- 230,110, 232,110, 234,104, 234,110,
- 236,110, 236,106, 234,104, 236,96,
- 244,88, 254,102, 254,106, 260,116,
- 264,116, 264,114, 256,104, 256,100,
- 264,108, 268,104, 268,100, 264,92,
- 264,88, 272,88, 276,84, 278,72,
- 272,68, 272,64, 268,64, 268,60,
- 274,60, 278,68, 280,68, 282,66,
- 278,60, 278,56, 282,56, 282,56,
- 272,36, 272,32, 282,32, 282,28,
- 286,28, 286,36, 294,42, 296,40,
- 290,30, 296,24, 294,20, 300,20,
- 298,16, 292,16, 288,14, 276,14,
- 276,16, 268,16, 268,14, 252,14,
- 252,16, 244,16, 244,14, 230,14,
- 228,10, 220,10, 220,8, 216,8,
- 212,4, 208,8, 210,8, 210,6,
- 212,6, 212,10, 216,10, 216,14,
- 212,14, 204,18, 208,24, 204,24,
- 200,16, 198,16, 198,20, 200,24,
- 188,24, 184,26, 182,22, 180,22,
- 180,28, 176,30, 176,28, 178,26,
- 168,20, 164,20, 148,34, 148,40,
- 152,38, 158,42, 160,40, 160,34,
- 164,28, 168,32, 164,36, 166,40,
- 160,44, 152,44, 152,40, 150,40,
- 150,44, 140,52, 138,52, 140,56,
- 140,58, 132,58, 130,66, 134,68,
- 142,66, 142,62, 152,58, 158,66,
- 158,68, 160,68, 160,62, 152,56,
- 158,56, 166,68, 166,64, 172,62,
- 172,56, 176,56, 178,58, 180,54,
- 184,54, 182,56, 186,60, 176,60,
- 170,66, 172,68, 180,68, 180,76,
- 172,76, 166,72, 160,76, 152,72,
- 152,68, 142,68, 140,70, 134,70,
- 130,72,
-
- -1,-1,192,56,
- 196,54, 200,68, 196,68, 192,56,
-
- -1,-2};
-
-
- int cga2ega(int *PIX,unsigned color)
- {
- /* illustrates integer conversion of screen coordinates from */
- /* CGA MED RES graphics mode to 640 x 350 EGA mode */
-
- int X=0,Y=1,true=X,done=Y;
- int newx,oldx,newy,oldy;
-
- drawstart:;
-
- /* conversion from 320 x 200 to 640 x 350 */
- oldx= PIX[X]<<1; /* use a ratio 320 to 640 for the x dimn */
- oldy=(PIX[Y]*7)/4; /* use a ratio of 350 to 200 for the y dimn */
-
- while(done!=true)
- {
- X=X+2 ; Y=Y+2;
- if(PIX[X]!=(-1)){
- newx=PIX[X]<<1;
- newy=(PIX[Y]*7)/4;
- writeline(oldx,oldy,newx,newy,color);
- oldx=newx;
- oldy=newy;
- }
- else(done=true);
- }
- true = 0; done = 1;
- if (PIX[X]==PIX[Y]){ X=X+2;Y=Y+2;
- goto drawstart;
- }
-
-
- }
-
-
- main()
- {
-
- char buf[4][66];
- int i,j,x,y;
-
-
- if(setcrtmode(EGA)!=EGA)
- {
- puts("Sorry... EGA required.");
- exit(0);
- }
-
-
- flood(BLUE); /* flood dark blue */
- linebox(0,0,639,349,RED); /* draw a red box */
- cga2ega(USA,LCYAN); /* draw the map of the USA in cyan */
- /* test the text routine.. white text */
- egatextM("Press any Key To See The World",319,330,BWHITE);
- getch();
-
- flood(RED); /* flood red */
- linebox(0,0,639,349,BWHITE); /* make a white box */
- cga2ega(WORLD,YELLOW); /* draw the map of the world */
-
- /* tell them who we are */
- egatextM("Another World Class Production by Bill Buckels",
- 380,320,BWHITE);
- egatextM("Winnipeg, Manitoba, Canada *** Sept 1991",
- 380,335,BWHITE);
- getch();
- setcrtmode(3);
- exit(0);
-
- }
-
-